package org.grayrabbit.cms.entity;

// Generated 2011-5-16 13:39:30 by Hibernate Tools 3.3.0.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

/**
 * CmsSurveyRecord generated by hbm2java
 */
@Entity
@Table(name = "CMS_SURVEY_RECORD")
public class SurveyRecord implements java.io.Serializable {

	private static final long serialVersionUID = 7792236535899818129L;
	private String recordId;
	private Survey survey;
	private String recordIp;
	private String recordUserName;
	private Date createTime;
	private Set<OptionAnswer> optionAnswers = new HashSet<OptionAnswer>(
			0);

	public SurveyRecord() {
	}

	public SurveyRecord(String recordId) {
		this.recordId = recordId;
	}

	@Id
	@Column(name = "RECORD_ID", unique = true, nullable = false, length = 32)
	@GeneratedValue(generator = "paymentableGenerator")       
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid") 
	public String getRecordId() {
		return this.recordId;
	}

	public void setRecordId(String recordId) {
		this.recordId = recordId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SURVEY_ID")
	public Survey getSurvey() {
		return survey;
	}

	public void setSurvey(Survey survey) {
		this.survey = survey;
	}
	
	@Column(name = "RECORD_IP", length = 64)
	public String getRecordIp() {
		return this.recordIp;
	}

	public void setRecordIp(String recordIp) {
		this.recordIp = recordIp;
	}

	@Column(name = "RECORD_USER_NAME", length = 64)
	public String getRecordUserName() {
		return this.recordUserName;
	}

	public void setRecordUserName(String recordUserName) {
		this.recordUserName = recordUserName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "CREATE_TIME", length = 7)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "surveyRecord")
	public Set<OptionAnswer> getOptionAnswers() {
		return optionAnswers;
	}

	public void setOptionAnswers(Set<OptionAnswer> optionAnswers) {
		this.optionAnswers = optionAnswers;
	}

}
